<?php

include_once './predis/autoload.php';

$conf=[
	'host'=>'localhost',
	'port'=>'6379'
];

$redis=new Predis\Client($conf);
#选择数据库
$redis->select(1);
#设置数据
$user1=[
	'name'=>'Tom',
	'age'=>'32'
];
$redis->hmset('user:1',$user1);

#取得数组的键名数组
$users=array_keys($user1);

echo "<pre>";
print_r( $redis->hmget('user:1','name', 'age') );

$us=$redis->hgetall('user:1');

foreach($us as $v){
	echo $v."<br>";	
}

?>